/**
 * 签单审核
 * Created by douxc on 2015/4/22.
 */
define(function (require, exports, module) {
  'use strict';
  module.exports = function (app) {
    app.register.controller('VerifyQuoteCtrl', ['$scope', '$routeParams', 'MHService',
      function ($scope, $routeParams, MHService) {
        var req = {
          content: '',
          ispassed: false,
          id: $routeParams['flag']
        };
        $scope.agree = function () {
          //同意签单
          req.content = $scope.description;
          req.ispassed = true;
          MHService.postReq({url: MHService.URL.verify_quote, _req: req}, function (data) {
            MHService.Toast('审批通过');
            history.go(-2);
          });
        };
        $scope.denied = function () {
          //拒绝签单
          req.content = $scope.description;
          req.ispassed = false;
          MHService.postReq({url: MHService.URL.verify_quote, _req: req}, function (data) {
            MHService.Toast('退回成功');
            history.go(-2);
          });
        };
      }]);
  };
});
